<html>
<head><meta charset="utf-8"><title>getting rid of cell and refcell usage · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html">getting rid of cell and refcell usage</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224402835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224402835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224402835">(Jan 28 2021 at 22:21)</a>:</h4>
<p>What is our plan for the usage of <code>Cell</code> and <code>RefCell</code> in <code>DocContext</code>? I'm guessing long-term we want to get rid of those?</p>



<a name="224402843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224402843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224402843">(Jan 28 2021 at 22:21)</a>:</h4>
<p>I know Joshua was working on this at one point.</p>



<a name="224403101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224403101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224403101">(Jan 28 2021 at 22:23)</a>:</h4>
<p>I'm starting off by trying to remove the <code>Cell</code> wrapper around <code>DocContext.param_env</code> and I'm getting 263 errors <span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span></p>



<a name="224403520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224403520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224403520">(Jan 28 2021 at 22:27)</a>:</h4>
<p>Down to 56.</p>



<a name="224403556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224403556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224403556">(Jan 28 2021 at 22:28)</a>:</h4>
<p>I can help by removing a whole field in <a href="https://github.com/rust-lang/rust/pull/81398/files#diff-2af9d5298f727457226da68b0dc427149fc68b3aa0d0fe64cca15b63c34af997L67">https://github.com/rust-lang/rust/pull/81398/files#diff-2af9d5298f727457226da68b0dc427149fc68b3aa0d0fe64cca15b63c34af997L67</a> <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="224403726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224403726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224403726">(Jan 28 2021 at 22:29)</a>:</h4>
<p>Yeah, I was wondering why there were two fields rather than one...</p>



<a name="224403765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224403765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224403765">(Jan 28 2021 at 22:30)</a>:</h4>
<p>Three if you count the global</p>



<a name="224404032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404032">(Jan 28 2021 at 22:32)</a>:</h4>
<p>For some reason <code>%s/cx: &amp;DocContext/cx: &amp;mut DocContext/g</code> in Vim (and the equivalent in sed) is producing stuff like <code>cx: cx: &amp;DocContextmut DocContext&lt;'_&gt;</code>. Any idea why?</p>



<a name="224404049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404049">(Jan 28 2021 at 22:32)</a>:</h4>
<p><code>:</code> and <code>&amp;</code> don't seem to be metachars in this context...</p>



<a name="224404116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404116">(Jan 28 2021 at 22:33)</a>:</h4>
<p>However, Sublime Text regex find &amp; replace is doing it correctly...</p>



<a name="224404176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404176">(Jan 28 2021 at 22:33)</a>:</h4>
<p>Sorry, I can't use anything more complicated than nano</p>



<a name="224404239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404239">(Jan 28 2021 at 22:34)</a>:</h4>
<p>You don't use Vim?</p>



<a name="224404258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404258">(Jan 28 2021 at 22:34)</a>:</h4>
<p>(or emacs)</p>



<a name="224404259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404259">(Jan 28 2021 at 22:34)</a>:</h4>
<p>Nah, hard on my nerves</p>



<a name="224404318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404318">(Jan 28 2021 at 22:35)</a>:</h4>
<p>I used to use nano before I learned how to use Vim. <em>"Why can't I exit this thing...?"</em></p>



<a name="224404376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404376">(Jan 28 2021 at 22:35)</a>:</h4>
<p>Maybe I'll try using nano for this then...</p>



<a name="224404393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404393">(Jan 28 2021 at 22:35)</a>:</h4>
<p>there's always the power button... anyway, I do most of my work on Windows, maybe a bit on WSL, so I wasn't ever forced to learn. Maybe I should, though.</p>



<a name="224404414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404414">(Jan 28 2021 at 22:36)</a>:</h4>
<p>sorry it's not the solution you're looking for <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="224404809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224404809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224404809">(Jan 28 2021 at 22:40)</a>:</h4>
<p>Also I think you'll find some places where the borrowchecker will be hard to please</p>



<a name="224410092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224410092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224410092">(Jan 28 2021 at 23:36)</a>:</h4>
<p>Wow, this is so hard <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="224423058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224423058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224423058">(Jan 29 2021 at 02:08)</a>:</h4>
<p>Well at least I got <a href="https://github.com/rust-lang/rust/issues/81495">#81495</a> along the way.</p>



<a name="224426073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224426073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224426073">(Jan 29 2021 at 03:08)</a>:</h4>
<p><span class="user-mention" data-user-id="307537">@Camelid</span> you want to escape &amp;, vim interprets that as "matched text" or something similar IIRC</p>



<a name="224427042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224427042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224427042">(Jan 29 2021 at 03:28)</a>:</h4>
<p>Huh, okay. I'll try that! Thanks for your help :)</p>



<a name="224427049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224427049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224427049">(Jan 29 2021 at 03:29)</a>:</h4>
<p>Got rid of one use of <code>Cell</code> <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> <a href="https://github.com/rust-lang/rust/issues/81497">#81497</a></p>



<a name="224428519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224428519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224428519">(Jan 29 2021 at 04:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/224426073">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> you want to escape &amp;, vim interprets that as "matched text" or something similar IIRC</p>
</blockquote>
<p>Yeah, it looks like you're right about that: <a href="https://stackoverflow.com/a/41508243">https://stackoverflow.com/a/41508243</a></p>



<a name="224483065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224483065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224483065">(Jan 29 2021 at 15:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/224404032">said</a>:</p>
<blockquote>
<p>For some reason <code>%s/cx: &amp;DocContext/cx: &amp;mut DocContext/g</code> in Vim (and the equivalent in sed) is producing stuff like <code>cx: cx: &amp;DocContextmut DocContext&lt;'_&gt;</code>. Any idea why?</p>
</blockquote>
<p>you need to escape <code>&amp;</code>: <code>\&amp;</code></p>



<a name="224483104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224483104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224483104">(Jan 29 2021 at 15:08)</a>:</h4>
<p>also I think I have a branch with this halfway done I linked a while back, I have so many branches I can't find it lol</p>



<a name="224522308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/224522308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#224522308">(Jan 29 2021 at 19:35)</a>:</h4>
<p>Yeah, you might have DM'd it to me at one point. It's probably easier to just restart though because it was a while ago.</p>



<a name="225221006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225221006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225221006">(Feb 04 2021 at 20:54)</a>:</h4>
<p>What do you all think would be the best places to start getting rid of interior mutability? These are the places that currently use <code>Cell</code> or <code>RefCell</code>:</p>
<div class="codehilite"><pre><span></span><code>src/librustdoc/json/mod.rs
34:    index: Rc&lt;RefCell&lt;FxHashMap&lt;types::Id, types::Item&gt;&gt;&gt;,

src/librustdoc/clean/types.rs
48:thread_local!(crate static MAX_DEF_IDX: RefCell&lt;FxHashMap&lt;CrateNum, DefIndex&gt;&gt; = Default::default());
60:    crate external_traits: Rc&lt;RefCell&lt;FxHashMap&lt;DefId, Trait&gt;&gt;&gt;,
1557:        static CELL: OnceCell&lt;FxHashMap&lt;PrimitiveType, ArrayVec&lt;[DefId; 4]&gt;&gt;&gt; = OnceCell::new();

src/librustdoc/passes/collect_intra_doc_links.rs
269:    kind_side_channel: Cell&lt;Option&lt;(DefKind, DefId)&gt;&gt;,

src/librustdoc/html/render/mod.rs
116:    id_map: Rc&lt;RefCell&lt;IdMap&gt;&gt;,
119:    deref_id_map: Rc&lt;RefCell&lt;FxHashMap&lt;DefId, String&gt;&gt;&gt;,
121:    all: Rc&lt;RefCell&lt;AllTypes&gt;&gt;,
149:    crate created_dirs: RefCell&lt;FxHashSet&lt;PathBuf&gt;&gt;,
360:thread_local!(crate static CURRENT_DEPTH: Cell&lt;usize&gt; = Cell::new(0));

src/librustdoc/html/format.rs
1337:struct WithFormatter&lt;F&gt;(Cell&lt;Option&lt;F&gt;&gt;);

src/librustdoc/core.rs
47:    crate resolver: Rc&lt;RefCell&lt;interface::BoxedResolver&gt;&gt;,
51:    crate param_env: Cell&lt;ParamEnv&lt;&#39;tcx&gt;&gt;,
53:    crate renderinfo: RefCell&lt;RenderInfo&gt;,
55:    crate external_traits: Rc&lt;RefCell&lt;FxHashMap&lt;DefId, clean::Trait&gt;&gt;&gt;,
58:    crate active_extern_traits: RefCell&lt;FxHashSet&lt;DefId&gt;&gt;,
62:    crate ty_substs: RefCell&lt;FxHashMap&lt;DefId, clean::Type&gt;&gt;,
64:    crate lt_substs: RefCell&lt;FxHashMap&lt;DefId, clean::Lifetime&gt;&gt;,
66:    crate ct_substs: RefCell&lt;FxHashMap&lt;DefId, clean::Constant&gt;&gt;,
68:    crate impl_trait_bounds: RefCell&lt;FxHashMap&lt;ImplTraitParam, Vec&lt;clean::GenericBound&gt;&gt;&gt;,
69:    crate fake_def_ids: RefCell&lt;FxHashMap&lt;CrateNum, DefIndex&gt;&gt;,
72:    crate generated_synthetics: RefCell&lt;FxHashSet&lt;(Ty&lt;&#39;tcx&gt;, DefId)&gt;&gt;,
80:    crate module_trait_cache: RefCell&lt;FxHashMap&lt;DefId, FxHashSet&lt;DefId&gt;&gt;&gt;,
425:) -&gt; Rc&lt;RefCell&lt;interface::BoxedResolver&gt;&gt; {
462:    resolver: Rc&lt;RefCell&lt;interface::BoxedResolver&gt;&gt;,
</code></pre></div>



<a name="225221075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225221075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225221075">(Feb 04 2021 at 20:55)</a>:</h4>
<p>Maybe getting rid of those <code>thread_local!</code>s would be good since they're global mutable state?</p>



<a name="225222572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225222572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225222572">(Feb 04 2021 at 21:07)</a>:</h4>
<p>Cell has no performance impact so I would focus on RefCell where possible</p>



<a name="225222711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225222711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225222711">(Feb 04 2021 at 21:08)</a>:</h4>
<p>MAX_DEF_ID I want to get rid of but it's a giant project: basically my idea is to make a <code>enum RustdocId { Real(DefId), Fake(usize) }</code> so you can tell when compiler APIs will panic (rather than constantly having to guess or read the code).</p>



<a name="225222828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225222828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225222828">(Feb 04 2021 at 21:09)</a>:</h4>
<p>you can get rid of the Cell in <code>WithFormatter</code> by changing the bound from <code>FnOnce</code> to <code>FnMut</code>, but that may cause other errors</p>



<a name="225222969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225222969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225222969">(Feb 04 2021 at 21:10)</a>:</h4>
<p>I think you may be able to get rid of <code>CURRENT_DEPTH</code> by making it a field on <code>FormatRenderer</code>?</p>



<a name="225222997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225222997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225222997">(Feb 04 2021 at 21:10)</a>:</h4>
<p>none of these are <em>easy</em> btw</p>



<a name="225223733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225223733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225223733">(Feb 04 2021 at 21:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225222828">said</a>:</p>
<blockquote>
<p>you can get rid of the Cell in <code>WithFormatter</code> by changing the bound from <code>FnOnce</code> to <code>FnMut</code>, but that may cause other errors</p>
</blockquote>
<p>I don't think so; IIUC the <code>Cell</code> is needed because it needs to mutate inside of a <code>Display::fmt</code> impl.</p>



<a name="225223773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225223773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225223773">(Feb 04 2021 at 21:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225222711">said</a>:</p>
<blockquote>
<p>MAX_DEF_ID I want to get rid of but it's a giant project: basically my idea is to make a <code>enum RustdocId { Real(DefId), Fake(usize) }</code> so you can tell when compiler APIs will panic (rather than constantly having to guess or read the code).</p>
</blockquote>
<p>That's a good idea!</p>



<a name="225223795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225223795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225223795">(Feb 04 2021 at 21:17)</a>:</h4>
<p>Thanks for the help!</p>



<a name="225226083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225226083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225226083">(Feb 04 2021 at 21:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225223733">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225222828">said</a>:</p>
<blockquote>
<p>you can get rid of the Cell in <code>WithFormatter</code> by changing the bound from <code>FnOnce</code> to <code>FnMut</code>, but that may cause other errors</p>
</blockquote>
<p>I don't think so; IIUC the <code>Cell</code> is needed because it needs to mutate inside of a <code>Display::fmt</code> impl.</p>
</blockquote>
<p>only because it calls take on the Option, if you have FnMut you wouldn't need the option and you could just reuse it</p>



<a name="225226102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225226102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225226102">(Feb 04 2021 at 21:33)</a>:</h4>
<p>maybe you would need Fn and not FnMut</p>



<a name="225228083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225228083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225228083">(Feb 04 2021 at 21:46)</a>:</h4>
<p>Yeah, you can't call a <code>FnMut</code> with only an <code>&amp;</code> reference to it.</p>



<a name="225228175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225228175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225228175">(Feb 04 2021 at 21:47)</a>:</h4>
<p>I tried changing it to <code>Fn</code>, but: <a href="https://github.com/rust-lang/rust/pull/81497#discussion_r566617150">https://github.com/rust-lang/rust/pull/81497#discussion_r566617150</a> <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="225228406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225228406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225228406">(Feb 04 2021 at 21:49)</a>:</h4>
<p>ah, that would do it</p>



<a name="225228430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225228430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225228430">(Feb 04 2021 at 21:49)</a>:</h4>
<p>I don't think it needs to change then</p>



<a name="225228443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225228443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225228443">(Feb 04 2021 at 21:49)</a>:</h4>
<p>maybe leave a comment</p>



<a name="225239244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225239244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225239244">(Feb 04 2021 at 23:21)</a>:</h4>
<p>What is <code>CURRENT_DEPTH</code> used for? It seems like it's for <code>../</code> in links?</p>



<a name="225244797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225244797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225244797">(Feb 05 2021 at 00:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/224483104">said</a>:</p>
<blockquote>
<p>also I think I have a branch with this halfway done I linked a while back, I have so many branches I can't find it lol</p>
</blockquote>
<p>I can sympathize: apparently I have 157 branches in my local repo <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> (I think most of them were merged, but I never deleted the branch locally)</p>



<a name="225248932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225248932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225248932">(Feb 05 2021 at 01:15)</a>:</h4>
<p>you can run <code>git fetch -p</code> which shows you which branches were deleted</p>



<a name="225248937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/225248937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#225248937">(Feb 05 2021 at 01:15)</a>:</h4>
<p>and then delete them locally too</p>



<a name="227046890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/227046890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#227046890">(Feb 19 2021 at 23:39)</a>:</h4>
<p>Would also be nice to get rid of all the <code>thread_local!</code>s.</p>



<a name="227046920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/getting%20rid%20of%20cell%20and%20refcell%20usage/near/227046920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage.html#227046920">(Feb 19 2021 at 23:39)</a>:</h4>
<p>Oops, looks like I said that already <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> <a href="#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225221075">https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/getting.20rid.20of.20cell.20and.20refcell.20usage/near/225221075</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>